package com;

import com.factory.BeanAnnotationFactory;
import com.factory.BeanFactory;
import com.proxy.TransactionProxyUtil;
import com.service.TransferService;
import org.junit.Test;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-02-28.
 *
 * @author zhoufy
 */
public class TestCase {


    @Test
    public void transfer() {
        TransferService accountService = (TransferService) BeanFactory.getInstance().getObject("transferService");
        accountService.transfer("10001", "10002", 1);

    }


    @Test
    public void annotationTransfer() throws ClassNotFoundException {

        TransactionProxyUtil proxyFactory = (TransactionProxyUtil) BeanAnnotationFactory.getInstance().getObject("transactionProxyUtil");

        TransferService accountService = (TransferService) proxyFactory.getProxyObject(BeanAnnotationFactory.getInstance().getObject("abcd"));

        accountService.transfer("10001", "10002", 1);
    }
}
